package com.oig.sys.workflow.constants;

import lombok.Getter;

public class FlowEnums {
    private FlowEnums(){}

    @Getter
    public enum FormType{
        INPUT("input"),
        TEXTAREA("textarea"),
        DATE("date"),
        DATE_INTERVAL("dateInterval"),
        RADIO("radioV2"),
        CHECKBOX("checkboxV2"),
        NUMBER("number"),
        AMOUNT("amount"),
        CONTACT("contact"),
        TELEPHONE("telephone"),
        ATTACHMENT("attachmentV2"),
        IMAGE("imageV2"),
        FIELD_LIST("fieldList"),
        ;
        private final String code;

        FormType(String code){
            this.code = code;
        }

        public static boolean validCode(String code) {
            for (FlowEnums.FormType enumItems : FlowEnums.FormType.values()) {
                if (enumItems.getCode().equals(code)) {
                    return true;
                }
            }
            return false;
        }
    }

    @Getter
    public enum FlowStatus{
        REQ_INIT("请求待提交"),
        PUSHED("已提交"),
        CAN_INIT("待撤销"),
        CANCELED("已撤销")
        ;
        private final String desc;

        public String getCode() {
            return this.name();
        }

        FlowStatus(String desc){
            this.desc = desc;
        }
    }

    @Getter
    public enum InstanceStatus {
        PENDING("进行中"),
        APPROVED("已同意"),
        REJECTED("已拒绝"),
        CANCELED("已撤回"),
        DELETED("已删除"),
        ;
        private final String desc;

        public String getCode() {
            return this.name();
        }

        InstanceStatus(String desc){
            this.desc = desc;
        }

    }

    @Getter
    public enum NotifyStatus{
        UN_NEED("无需通知"),
        SUCCESS("通知成功"),
        FAIL("通知失败"),
        PENDING("通知中"),
        INIT("初始态"),
        ;

        private final String desc;

        public String getCode() {
            return this.name();
        }

        NotifyStatus(String desc){
            this.desc = desc;
        }
    }

}
